home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Programming / MPW Interfaces & Libraries 3.1 / PInterfaces / Printing.p < prev    next >
Encoding:
Text File  |  1989-10-13  |  8.6 KB  |  328 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Thursday, May 4, 1989 at 5:06 PM
  3.     Printing.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.     Copyright Apple Computer, Inc.    1985-1988
  7.     All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Printing;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingPrinting}
  21. {$SETC UsingPrinting := 1}
  22.  
  23. {$I+}
  24. {$SETC PrintingIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingQuickdraw}
  27. {$I $$Shell(PInterfaces)Quickdraw.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingDialogs}
  30. {$I $$Shell(PInterfaces)Dialogs.p}
  31. {$ENDC}
  32. {$SETC UsingIncludes := PrintingIncludes}
  33.  
  34. CONST
  35. iPFMaxPgs = 128;
  36. iPrPgFract = 120;                        {Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract}
  37. iPrPgFst = 1;                            {Page range constants}
  38. iPrPgMax = 9999;
  39. iPrRelease = 3;                         {Current version number of the code.}
  40. iPrSavPFil = -1;
  41. iPrAbort = $0080;
  42. iPrDevCtl = 7;                            {The PrDevCtl Proc's ctl number}
  43. lPrReset = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  44. lPrLineFeed = $00030000;
  45. lPrLFStd = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  46. lPrLFSixth = $0003FFFF;
  47. lPrPageEnd = $00020000;                 {The PrDevCtl Proc's CParam for end page}
  48. lPrDocOpen = $00010000;
  49. lPrPageOpen = $00040000;
  50. lPrPageClose = $00020000;
  51. lPrDocClose = $00050000;
  52. iFMgrCtl = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  53. iMemFullErr = -108;
  54. iIOAbort = -27;
  55. pPrGlobals = $00000944;                 {The PrVars lo mem area:}
  56. bDraftLoop = 0;
  57. bSpoolLoop = 1;
  58. bUser1Loop = 2;
  59. bUser2Loop = 3;
  60. iPrBitsCtl = 4;
  61. lScreenBits = 0;
  62. lPaintBits = 1;
  63. lHiScreenBits = $00000002;                {The Bitmap Print Proc's Screen Bitmap param}
  64. lHiPaintBits = $00000003;                {The Bitmap Print Proc's Paint [sq pix] param}
  65. iPrIOCtl = 5;
  66. iPrEvtCtl = 6;                            {The PrEvent Proc's ctl number}
  67. lPrEvtAll = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  68. lPrEvtTop = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  69. iPrDrvrRef = -3;
  70. getRslDataOp = 4;
  71. setRslOp = 5;
  72. draftBitsOp = 6;
  73. noDraftBitsOp = 7;
  74. getRotnOp = 8;
  75. NoSuchRsl = 1;
  76. RgType1 = 1;
  77.  
  78.  
  79. TYPE
  80.  
  81. TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
  82.  
  83. TScan = (scanTB,scanBT,scanLR,scanRL);
  84.  
  85.  
  86. TPPrPort = ^TPrPort;
  87. TPrPort = RECORD
  88.     gPort: GrafPort;                    {The Printer's graf port.}
  89.     gProcs: QDProcs;                    {..and its procs}
  90.     lGParam1: LONGINT;                    {16 bytes for private parameter storage.}
  91.     lGParam2: LONGINT;
  92.     lGParam3: LONGINT;
  93.     lGParam4: LONGINT;
  94.     fOurPtr: BOOLEAN;                    {Whether the PrPort allocation was done by us.}
  95.     fOurBits: BOOLEAN;                    {Whether the BitMap allocation was done by us.}
  96.     END;
  97.  
  98. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  99. This is the "PrPeek" record. }
  100. TPPrInfo = ^TPrInfo;
  101. TPrInfo = RECORD
  102.     iDev: INTEGER;                        {Font mgr/QuickDraw device code}
  103.     iVRes: INTEGER;                     {Resolution of device, in device coordinates}
  104.     iHRes: INTEGER;                     {..note: V before H => compatable with Point.}
  105.     rPage: Rect;                        {The page (printable) rectangle in device coordinates.}
  106.     END;
  107.  
  108. { Print Info Record: The parameters needed for page composition. }
  109. TPPrStl = ^TPrStl;
  110. TPrStl = RECORD
  111.     wDev: INTEGER;
  112.     iPageV: INTEGER;
  113.     iPageH: INTEGER;
  114.     bPort: SignedByte;
  115.     feed: TFeed;
  116.     END;
  117.  
  118. TPPrXInfo = ^TPrXInfo;
  119. TPrXInfo = RECORD
  120.     iRowBytes: INTEGER;
  121.     iBandV: INTEGER;
  122.     iBandH: INTEGER;
  123.     iDevBytes: INTEGER;
  124.     iBands: INTEGER;
  125.     bPatScale: SignedByte;
  126.     bUlThick: SignedByte;
  127.     bUlOffset: SignedByte;
  128.     bUlShadow: SignedByte;
  129.     scan: TScan;
  130.     bXInfoX: SignedByte;
  131.     END;
  132.  
  133. TPPrJob = ^TPrJob;
  134. TPrJob = RECORD
  135.     iFstPage: INTEGER;                    {Page Range.}
  136.     iLstPage: INTEGER;
  137.     iCopies: INTEGER;                    {No. copies.}
  138.     bJDocLoop: SignedByte;                {The Doc style: Draft, Spool, .., and ..}
  139.     fFromUsr: BOOLEAN;                    {Printing from an User's App (not PrApp) flag}
  140.     pIdleProc: ProcPtr;                 {The Proc called while waiting on IO etc.}
  141.     pFileName: StringPtr;                {Spool File Name: NIL for default.}
  142.     iFileVol: INTEGER;                    {Spool File vol, set to 0 initially}
  143.     bFileVers: SignedByte;                {Spool File version, set to 0 initially}
  144.     bJobX: SignedByte;                    {An eXtra byte.}
  145.     END;
  146.  
  147. { Print Job: Print "form" for a single print request. }
  148. TPPrint = ^TPrint;
  149. THPrint = ^TPPrint;
  150. TPrint = RECORD
  151.     iPrVersion: INTEGER;                {(2) Printing software version}
  152.     prInfo: TPrInfo;                    {(14) the PrInfo data associated with the current style.}
  153.     rPaper: Rect;                        {(8) The paper rectangle [offset from rPage]}
  154.     prStl: TPrStl;                        {(8)  This print request's style.}
  155.     prInfoPT: TPrInfo;                    {(14)  Print Time Imaging metrics}
  156.     prXInfo: TPrXInfo;                    {(16)  Print-time (expanded) Print info record.}
  157.     prJob: TPrJob;                        {(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120}
  158.     printX: ARRAY [1..19] OF INTEGER;    {Spare to fill to 120 bytes!}
  159.     END;
  160.  
  161. { The universal 120 byte printing record }
  162. TPPrStatus = ^TPrStatus;
  163. TPrStatus = RECORD
  164.     iTotPages: INTEGER;                 {Total pages in Print File.}
  165.     iCurPage: INTEGER;                    {Current page number}
  166.     iTotCopies: INTEGER;                {Total copies requested}
  167.     iCurCopy: INTEGER;                    {Current copy number}
  168.     iTotBands: INTEGER;                 {Total bands per page.}
  169.     iCurBand: INTEGER;                    {Current band number}
  170.     fPgDirty: BOOLEAN;                    {True if current page has been written to.}
  171.     fImaging: BOOLEAN;                    {Set while in band's DrawPic call.}
  172.     hPrint: THPrint;                    {Handle to the active Printer record}
  173.     pPrPort: TPPrPort;                    {Ptr to the active PrPort}
  174.     hPic: PicHandle;                    {Handle to the active Picture}
  175.     END;
  176.  
  177. { Print Status: Print information during printing. }
  178. TPPfPgDir = ^TPfPgDir;
  179. THPfPgDir = ^TPPfPgDir;
  180. TPfPgDir = RECORD
  181.     iPages: INTEGER;
  182.     iPgPos: ARRAY [0..128] OF LONGINT;    {ARRAY [0..iPfMaxPgs] OF LONGINT}
  183.     END;
  184.  
  185. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  186. TPPrDlg = ^TPrDlg;
  187. TPrDlg = RECORD
  188.     Dlg: DialogRecord;                    {The Dialog window}
  189.     pFltrProc: ProcPtr;                 {The Filter Proc.}
  190.     pItemProc: ProcPtr;                 {The Item evaluating proc.}
  191.     hPrintUsr: THPrint;                 {The user's print record.}
  192.     fDoIt: BOOLEAN;
  193.     fDone: BOOLEAN;
  194.     lUser1: LONGINT;                    {Four longs for user's to hang global data.}
  195.     lUser2: LONGINT;                    {...Plus more stuff needed by the particular printing dialog.}
  196.     lUser3: LONGINT;
  197.     lUser4: LONGINT;
  198.     END;
  199.  
  200. TGnlData = RECORD
  201.     iOpCode: INTEGER;
  202.     iError: INTEGER;
  203.     lReserved: LONGINT;                 {more fields here depending on call}
  204.     END;
  205.  
  206. TRslRg = RECORD
  207.     iMin: INTEGER;
  208.     iMax: INTEGER;
  209.     END;
  210.  
  211. TRslRec = RECORD
  212.     iXRsl: INTEGER;
  213.     iYRsl: INTEGER;
  214.     END;
  215.  
  216. TGetRslBlk = RECORD
  217.     iOpCode: INTEGER;
  218.     iError: INTEGER;
  219.     lReserved: LONGINT;
  220.     iRgType: INTEGER;
  221.     xRslRg: TRslRg;
  222.     yRslRg: TRslRg;
  223.     iRslRecCnt: INTEGER;
  224.     rgRslRec: ARRAY [1..27] OF TRslRec;
  225.     END;
  226.  
  227. TSetRslBlk = RECORD
  228.     iOpCode: INTEGER;
  229.     iError: INTEGER;
  230.     lReserved: LONGINT;
  231.     hPrint: THPrint;
  232.     iXRsl: INTEGER;
  233.     iYRsl: INTEGER;
  234.     END;
  235.  
  236. TDftBitsBlk = RECORD
  237.     iOpCode: INTEGER;
  238.     iError: INTEGER;
  239.     lReserved: LONGINT;
  240.     hPrint: THPrint;
  241.     END;
  242.  
  243. TGetRotnBlk = RECORD
  244.     iOpCode: INTEGER;
  245.     iError: INTEGER;
  246.     lReserved: LONGINT;
  247.     hPrint: THPrint;
  248.     fLandscape: BOOLEAN;
  249.     bXtra: SignedByte;
  250.     END;
  251.  
  252. TPRect = ^Rect;                         { A Rect Ptr }
  253.  
  254. TPBitMap = ^BitMap;                     { A BitMap Ptr }
  255.  
  256. TN = 0..15;                             { a Nibble }
  257.  
  258. TPWord = ^TWord;
  259. THWord = ^TPWord;
  260. TWord = PACKED RECORD
  261.     CASE INTEGER OF
  262.       0:
  263.         (c1,c0: CHAR);
  264.       1:
  265.         (b1,b0: SignedByte);
  266.       2:
  267.         (usb1,usb0: Byte);
  268.       3:
  269.         (n3,n2,n1,n0: TN);
  270.       4:
  271.         (f15,f14,f13,f12,f11,f10,f9,f8,f7,f6,f5,f4,f3,f2,f1,f0: BOOLEAN);
  272.       5:
  273.         (i0: INTEGER);
  274.     END;
  275.  
  276. TPLong = ^TLong;
  277. THLong = ^TPLong;
  278. TLong = RECORD
  279.     CASE INTEGER OF
  280.       0:
  281.         (w1,w0: TWord);
  282.       1:
  283.         (b1,b0: LONGINT);
  284.       2:
  285.         (p0: Ptr);
  286.       3:
  287.         (h0: Handle);
  288.       4:
  289.         (pt: Point);
  290.     END;
  291.  
  292.  
  293.  
  294. PROCEDURE PrPurge;
  295. PROCEDURE PrNoPurge;
  296. PROCEDURE PrOpen;
  297. PROCEDURE PrClose;
  298. PROCEDURE PrintDefault(hPrint: THPrint);
  299. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  300. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  301. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  302. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  303. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  304. PROCEDURE PrJobMerge(hPrintSrc: THPrint;hPrintDst: THPrint);
  305. FUNCTION PrDlgMain(hPrint: THPrint;pDlgInit: ProcPtr): BOOLEAN;
  306. FUNCTION PrOpenDoc(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr): TPPrPort;
  307. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  308. PROCEDURE PrOpenPage(pPrPort: TPPrPort;pPageFrame: TPRect);
  309. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  310. PROCEDURE PrPicFile(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr;pDevBuf: Ptr;
  311.     VAR prStatus: TPrStatus);
  312. FUNCTION PrError: INTEGER;
  313. PROCEDURE PrSetError(iErr: INTEGER);
  314. PROCEDURE PrGeneral(pData: Ptr);
  315. PROCEDURE PrDrvrOpen;
  316. PROCEDURE PrDrvrClose;
  317. PROCEDURE PrCtlCall(iWhichCtl: INTEGER;lParam1: LONGINT;lParam2: LONGINT;
  318.     lParam3: LONGINT);
  319. FUNCTION PrDrvrDCE: Handle;
  320. FUNCTION PrDrvrVers: INTEGER;
  321.  
  322. {$ENDC}    { UsingPrinting }
  323.  
  324. {$IFC NOT UsingIncludes}
  325.     END.
  326. {$ENDC}
  327.  
  328.